<?php
/**
 * 团队成员卡片组件
 * 依赖参数:
 * - $member: 团队成员数据数组
 * - $teamConfig: 团队组件配置数组
 * - $avatarShapeClass: 头像形状样式类
 * - $cardClass: 卡片样式类
 */

// 确保必要参数已定义
if (!isset($member) || !isset($teamConfig) || !isset($avatarShapeClass) || !isset($cardClass)) {
    return;
}
?>

<div class="team-member group <?php echo $cardClass; ?> rounded-xl overflow-hidden">
    <!-- 成员头像 -->
    <div class="relative overflow-hidden <?php echo $avatarShapeClass; ?> mb-6 aspect-square">
        <img 
            src="<?php echo htmlspecialchars($member['avatar']); ?>" 
            alt="<?php echo htmlspecialchars($member['name']); ?>的照片"
            class="w-full h-full object-cover object-center transition-transform duration-700 group-hover:scale-110"
            loading="lazy"
        >
        
        <!-- 悬停时显示的社交链接 -->
        <?php if ($teamConfig['show_social'] && !empty($member['social_links'])): ?>
            <div class="absolute inset-0 bg-primary/80 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-all duration-300">
                <div class="flex space-x-3 transform translate-y-4 group-hover:translate-y-0 transition-transform duration-300">
                    <?php foreach ($member['social_links'] as $link): ?>
                        <a 
                            href="<?php echo htmlspecialchars($link['url']); ?>" 
                            class="w-10 h-10 rounded-full bg-white flex items-center justify-center text-primary hover:bg-gray-100 transition-colors duration-300"
                            aria-label="访问<?php echo htmlspecialchars($member['name']); ?>的社交媒体"
                            <?php if (strpos($link['url'], 'http') === 0): ?>target="_blank" rel="noopener noreferrer"<?php endif; ?>
                        >
                            <i class="<?php echo htmlspecialchars($link['icon']); ?>"></i>
                        </a>
                    <?php endforeach; ?>
                </div>
            </div>
        <?php endif; ?>
    </div>
    
    <!-- 成员信息 -->
    <div class="p-4 text-center">
        <h3 class="text-xl font-semibold text-gray-900 mb-1 group-hover:text-primary transition-colors duration-300">
            <?php echo htmlspecialchars($member['name']); ?>
        </h3>
        <p class="text-primary font-medium mb-3">
            <?php echo htmlspecialchars($member['position']); ?>
        </p>
        
        <!-- 成员简介 -->
        <?php if ($teamConfig['show_bio'] && !empty($member['bio'])): ?>
            <p class="text-gray-600">
                <?php echo htmlspecialchars($member['bio']); ?>
            </p>
        <?php endif; ?>
    </div>
</div>
    